package ALDITS;

import java.util.ArrayList;

public class Team {
	String name;
	Player [] players;
	public int getAvgSpeed2()
	{
		int sum = 0;
		for (int i = 0; i < players.length; i++)
		{
			sum += players[i].getSpeed();
		}
		return sum;
	}
	public int getAvgHealth()
	{
		int sum = 0;
		for (int i = 0; i < players.length; i++)
		{
			sum += players[i].getHealth();
		}
		return sum;
	}
	public String getName()
	{
		return name;
	}
	public int getLanded()
	{
		int sum = 0;
		for (int i = 0; i < players.length; i++)
		{
			if (players[i].landed)
				sum++;
		}
		return sum;
	}
        
        public void findMembers(ArrayList<Player> all,int teamID){
        int i=-1;
        players = new Player[all.size()/2];
        for(Player p: all)
            if(p.teamID==teamID){
                players[i++]=p;
            }
        }

}
